#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<errno.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<unistd.h> 
#include<pthread.h>


int
main(void)
{
	char* path = "text.txt";
		
	open(path, O_RDONLY | O_CREAT, 0555);
	if(!access(path, W_OK)){
		printf("file can be writen\n");
	}
	else perror("file cannot be writen");

	printf("after change mod\n");

	chmod(path, S_IWUSR);

	if(!access(path, W_OK)){
		printf("file can be writen\n");
	}
	else perror("file cannot be writen");

	return 0;
	
}
